/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.fastcase.item.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.punish.fastcase.item.service.ISearchRecordService;
import com.icinfo.cloud.provider.punish.item.model.SearchRecord;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 简案快办-事项搜索
 *
 * @author liuyongfei
 * @date 2022/12/01
 */
@RestController
@RequestMapping("/app/item")
public class ItemSearchController extends BaseController {
    @Resource
    private ISearchRecordService searchRecordService;
    // 修复jar包漏洞，移除freedom-discretion-provider-api:jar相关
//    @Resource
//    private ItemFeignApi itemFeignApi;
//    @Resource
//    private DimensionConfigFeignApi dimensionConfigFeignApi;

    /**
     * 事项搜索列表
     *
     * @param itemSearchPageDto 事项搜索参数对象
     * @return com.icinfo.framework.common.web.Result<com.icinfo.cloud.common.core.page.PageResponse < com.icinfo.cloud.discretion.item.vo.ItemSearchVo>>
     * @author liuyongfei
     * @date 2022/12/01
     */
    @PostMapping("/getItemSearchList")
    @ApiOperation(value = "事项搜索列表", httpMethod = "POST")
    public Result<PageResponse<Object>> getItemSearchList(@RequestBody Object itemSearchPageDto) {
        // 修复jar包漏洞，移除freedom-discretion-provider-api:jar相关
//    public Result<PageResponse<ItemSearchVo>> getItemSearchList(@RequestBody ItemSearchPageDto itemSearchPageDto) {
//        return itemFeignApi.getItemSearchList(itemSearchPageDto);
        return null;
    }

    /**
     * 获取当前用户的搜索记录
     *
     * @return java.util.List<com.icinfo.cloud.provider.item.model.SearchRecord>
     * @author liuyongfei
     * @date 2022/11/30
     */
    @PostMapping("/getSearchRecordList")
    @ApiOperation(value = "获取当前用户的搜索记录", httpMethod = "POST")
    public Result<List<SearchRecord>> getSearchRecordList() {
        return Result.success(searchRecordService.getSearchRecordList());
    }

    /**
     * 新增搜索记录
     *
     * @param searchRecord 搜索记录参数实体
     * @return java.lang.Boolean
     * @author liuyongfei
     * @date 2022/11/30
     */
    @PostMapping("/saveSearchRecord")
    @ApiOperation(value = "新增搜索记录", httpMethod = "POST")
    public Result<String> saveSearchRecord(@RequestBody SearchRecord searchRecord) {
        Boolean isSuccess = searchRecordService.saveSearchRecord(searchRecord);
        return isSuccess ? Result.success("新增成功！") : Result.error("新增失败！");
    }

    /**
     * 删除当前用户的搜索记录
     *
     * @return java.lang.Boolean
     * @author liuyongfei
     * @date 2022/11/30
     */
    @PostMapping("/deleteSearchRecord")
    @ApiOperation(value = "删除当前用户的搜索记录", httpMethod = "POST")
    public Result<String> deleteSearchRecord() {
        Boolean isSuccess = searchRecordService.deleteSearchRecord();
        return isSuccess ? Result.success("删除成功！") : Result.error("删除失败！");
    }

    /**
     * 查询事项下的维度配置
     *
     * @param dimensionConfigDto 维度配置参数
     * @return com.icinfo.framework.common.web.Result<com.icinfo.cloud.discretion.dimension.vo.DimensionConfigVo>
     * @author liuyongfei
     * @date 2022/12/01
     */
    @PostMapping("/getDimensionConfig")
    @ApiOperation(value = "查询维度配置", httpMethod = "POST")
    public Result<Object> getDimensionConfig(@RequestBody Object dimensionConfigDto) {
        // 修复jar包漏洞，移除freedom-discretion-provider-api:jar相关
//    public Result<DimensionConfigVo> getDimensionConfig(@RequestBody DimensionConfigDto dimensionConfigDto) {
//        return dimensionConfigFeignApi.getDimensionConfig(dimensionConfigDto);
        return null;
    }

    /**
     * 查询事项裁量设置因素及处罚标准限制规则详情
     *
     * @param itemAreaLineIdDto 区域事项id DTO类
     * @return com.icinfo.framework.common.web.Result<com.icinfo.cloud.discretion.item.vo.ItemAreaLineInfoVo>
     * @author liuyongfei
     * @date 2022/12/01
     */
    @PostMapping(value = "/getItemRuleConfigDetail")
    @ApiOperation(value = "描述：查询事项裁量设置因素及处罚标准限制规则详情", httpMethod = "POST")
    public Result<Object> getItemRuleConfigDetail(@RequestBody Object itemAreaLineIdDto) {
        // 修复jar包漏洞，移除freedom-discretion-provider-api:jar相关
//    public Result<ItemAreaLineInfoVo> getItemRuleConfigDetail(@RequestBody ItemAreaLineIdDto itemAreaLineIdDto) {
//        return itemFeignApi.getItemRuleConfigDetail(itemAreaLineIdDto);
        return null;
    }

    /**
     * 获取项法律法规及提示文档详情
     *
     * @param itemAreaLineIdDto 区域事项id DTO类
     * @return com.icinfo.framework.common.web.Result<java.lang.String>
     * @author liuyongfei
     * @date 2022/12/02
     */
    @PostMapping(value = "/getItemLawsRegulationsFilesDetail")
    @ApiOperation(value = "描述：获取项法律法规及提示文档详情", httpMethod = "POST")
    public Result<Object> getItemLawsRegulationsFilesDetail(@RequestBody Object itemAreaLineIdDto) {
        // 修复jar包漏洞，移除freedom-discretion-provider-api:jar相关
//    public Result<ItemLawsRegulationsFilesInfoVo> getItemLawsRegulationsFilesDetail(@RequestBody ItemAreaLineIdDto itemAreaLineIdDto) {
//        return itemFeignApi.getItemLawsRegulationsFilesDetail(itemAreaLineIdDto);
        return null;
    }
}